﻿using System;
using Microsoft.Xna.Framework;

namespace GP2D3D_Homework1_RickBeijer_S1012261
{
    /// <summary>
    /// A holder for location and dimension details. This class can be used to compare different graphical
    /// objects, using their location and dimension.
    /// </summary>
    public class LocationDimensionPair : IEquatable<LocationDimensionPair>, IComparable<LocationDimensionPair>
    {
        public Vector3 Location
        {
            get;
            set;
        }

        public Vector3 Dimension
        {
            get;
            set;
        }

        public LocationDimensionPair()
        {
        }

        public LocationDimensionPair(Vector3 location, Vector3 dimension)
        {
            this.Location = location;
            this.Dimension = dimension;
        }

        public bool Equals(LocationDimensionPair other)
        {
            return this.Location.X == other.Location.X &&
                   this.Location.Y == other.Location.Y &&
                   this.Location.Z == other.Location.Z;
        }

        public int CompareTo(LocationDimensionPair other)
        {
            if ( this.Equals( other ) )
            {
                return 0;
            }

            if ( this.Dimension.X > other.Dimension.X &&
                 this.Dimension.Y > other.Dimension.Y &&
                 this.Dimension.Z > other.Dimension.Z )
            {
                return 1;
            }

            return 0;
        }
    }
}